    <!-- application/layouts/scripts/layout.phtml -->
     
    <?php 
        //DB
        $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini','staging');
        Zend_Registry::set('config',$config);

        $db = Zend_Db::factory($config->db);
        Zend_Registry::set('db',$db);

        echo $this->doctype()
    ?>
    <html>
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>Eating - ZendFramework</title>
      <?php echo $this->headLink()->appendStylesheet('/css/global.css') ?>
    </head>
    <body>
        <div class="bodyform">
            <a href="/">
                <div class="header">
                    <img src="/images/hamburgerHead-icon.png" style="float: left" />
                    <h1>Eating - ZendFramework</h1>
                </div>
            </a>
            <div class="trunk">
                <div class="trunkbody">
                    <?php echo $this->layout()->content ?>
                </div>
                <div class="navi">
                    <div class="navi2">
                        <div class="navi3">
                            <table>
                                <tr>
                                    <td>
                                       <img src="/images/login-icon.png" /> 
                                    </td>
                                    <td>
                                       <?php if ($_SESSION['logged'] != true) { ?>
                                       <a href="<?php echo $this->url(
                                               array('controller' => 'index',
                                                     'action' => 'login'),
                                                     'default',true); ?>">Login</a>
                                        <?php } else { ?>
                                        <a href="<?php echo $this->url(
                                               array('controller' => 'index',
                                                     'action' => 'logout'),
                                                     'default',true); ?>">Logout</a>
                                        <?php } ?>
                                    </td>
                                </tr>
                                <?php if ($_SESSION['logged'] != true) { ?>
                                <tr style="height: 20px"></tr>
                                <tr>
                                    <td>
                                       <img src="/images/register-icon.png" /> 
                                    </td>
                                    <td>
                                      <a href="<?php echo $this->url(
                                               array('controller' => 'index',
                                                     'action' => 'register'),
                                                     'default',true); ?>">Registrieren</a>
                                    </td>
                                </tr>
                                <?php } ?>
                            </table>
                        </div>
                    </div>
                    <?php if ($_SESSION['logged'] == true) { ?>
                    <br />
                    <div class="navi2">
                        <div class="navi3">
                            <table>
                                <?php if ($_SESSION['bestellung'] == NULL) { ?>
                                <tr>
                                    <td>
                                       <img src="/images/order-icon.png" /> 
                                    </td>
                                    <td>
                                       <a href="<?php echo $this->url(
                                               array('controller' => 'order',
                                                     'action' => 'order'),
                                                     'default',true); ?>">Bestellen</a>
                                    </td>
                                </tr>
                                <?php } if ($_SESSION['companyshow'] == 1) { ?>
                                <tr style="height: 20px"></tr>
                                <tr>
                                    <td>
                                       <img src="/images/company-icon.png" /> 
                                    </td>
                                    <td>
                                       <a href="<?php echo $this->url(
                                               array('controller' => 'company',
                                                     'action' => 'company'),
                                                     'default',true); ?>">Firma anlegen</a>
                                    </td>
                                </tr>
                                <?php } if ($_SESSION['my_firma'] != NULL) { ?>
                                <tr style="height: 20px"></tr>
                                <tr>
                                    <td>
                                       <img src="/images/user-icon.png" /> 
                                    </td>
                                    <td>
                                       <a href="<?php echo $this->url(
                                               array('controller' => 'company',
                                                     'action' => 'user'),
                                                     'default',true); ?>">Benutzer einladen</a>
                                    </td>
                                </tr>
                                <?php } if ($_SESSION['admin'] == 1) { ?>
                                <tr style="height: 20px"></tr>
                                <tr>
                                    <td>
                                       <img src="/images/caterer-icon.png" /> 
                                    </td>
                                    <td>
                                       <a href="<?php echo $this->url(
                                               array('controller' => 'caterer',
                                                     'action' => 'create'),
                                                     'default',true); ?>">Caterer anlegen</a>
                                    </td>
                                </tr>
                                <?php } ?>
                            </table>
                        </div>
                    </div>
                    <br />
                    <div class="navi2">
                        <div class="navi3">
                            <b>Eingeloggt</b> <br /><br />
                            <b>Name: </b><?php echo $_SESSION['name'] ?></font><br />
                            <b>Vorname: </b><?php echo $_SESSION['vorname'] ?></font><br />
                            <b>Firma: </b><?php echo $_SESSION['firma'] ?></font><br />
                            <b>E-Mail:</b><br />
                            <?php echo $_SESSION['email'] ?></font><br />
                        </div>
                    </div>
                    <br />
                    <div class="navi2">
                        <div class="navi3">
                            <b>Deine Bestellung</b> <br /><br />
                            <?php 
                                if ($_SESSION['bestellung'] != NULL) {
                                    echo '<b>Bei: </b><br />';
                                    echo $_SESSION['bestellungC'];
                                    echo '<br /><b>Deine Wahl: </b><br />';
                                    echo $_SESSION['bestellungE'];
                                } else {
                                    echo 'Noch keine Bestellung';
                                }
                            ?> 
                        </div>
                    </div>
                    <?php } if ($_SESSION['my_firma'] != NULL) { ?>
                    <br />
                    <div class="navi2">
                        <div class="navi3">
                            <b>Offene Einladungen: </b>
                            <?php 
                                $data = $db->fetchAll('SELECT * FROM user u, userfirma uf WHERE uf.status = 1 AND uf.user_id = u.user_id AND uf.firma_id = ' . $_SESSION['my_firma']);
                                
                                if ($data) {
                                    for ($i = 0; $i < count($data); $i++) {
                                        echo $data[$i]['email'].'<br />';
                                    }
                                } else {
                                    echo 'Keine';
                                }
                            ?>
                        </div>
                    </div>
                    <?php } if ($_SESSION['load'] == 1) { ?>
                    <br />
                    <div class="navi2">
                        <div class="navi3">
                            <b>Du wurdest zu einer Firma eingeladen:</b>
                            <?php if ($_SESSION['loadname'] != NULL) { ?>
                            <table align="center" style="text-align: center">
                                <tr>
                                    <td width="140px" colspan="2">
                                        <h3>
                                            <?php 
                                                echo $_SESSION['loadname'];
                                            ?>
                                        </h3>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left">
                                        <a href="/company/accept"><img src="/images/invite_accept.png" /></a>
                                    </td>
                                    <td align="right">
                                        <a href="/company/dontaccept"><img src="/images/invite_dont_accept.png" /></a>
                                    </td>
                                </tr>
                            </table>
                            <?php } ?>
                        </div>
                    </div>
                    <?php } ?>
                </div>
            </div>
        </div>
        <div class="footer">
            <div class="footer2">
                Erstellt von: Simon Zwicker, 2011
            </div>
        </div>
    </body>
    </html>